package br.com.maquina.adapters;
import android.content.*;
import android.view.*;
import android.widget.*;
import br.com.maquina.modelo.*;
import java.util.*;
import br.com.maquina.*;

public class GridAdapter extends BaseAdapter
{

	private ArrayList<Condicao> condicao;
	private LayoutInflater inflater;

	public GridAdapter(Context context, ArrayList<Condicao> condicao)
	{
		this.condicao = condicao;
		this.inflater = LayoutInflater.from(context);
	}
	
	public int getCount()
	{
		// TODO: Implement this method
		return condicao.size();
	}

	public Object getItem(int position)
	{
		// TODO: Implement this method
		return condicao.get(position);
	}

	public long getItemId(int position)
	{
		// TODO: Implement this method
		return position;
	}

	public View getView(int position, View convertView, ViewGroup parent)
	{
		convertView = inflater.inflate(R.layout.grid_layout,null);
		TextView estado = (TextView) convertView.findViewById(R.id.textViewEstado);
		TextView fita = (TextView) convertView.findViewById(R.id.textViewCondicao );
		TextView proxEstado = (TextView) convertView.findViewById(R.id.textViewProxEstado);
		TextView escreve = (TextView) convertView.findViewById(R.id.textViewEscreve);
		TextView movimento = (TextView) convertView.findViewById(R.id.textViewMovimento);

		estado.setText(String.valueOf(condicao.get(position).getEstado()));
		fita.setText(condicao.get(position).getFita());
		proxEstado.setText(String.valueOf( condicao.get(position).getProxEstado()));
		escreve.setText(condicao.get(position).getEscreve());
		movimento.setText(condicao.get(position).getMovimento());
		
		return convertView;
	}
	
}
